FUNCTION DAC_ResetBitOfWord :Word
TITLE = 'DAC_ResetBitOfWord'
//
// This functionblock reset a single bit in a word
// 
// Versionshistory:
// 1.0 Ersterstellung E.Dittmann

VERSION : '1.0'
AUTHOR  : 'Lenze'
FAMILY  : 'DAC'
NAME : 'xResetw'
KNOW_HOW_PROTECT

CONST
    dat := W#16#1;
END_CONST

VAR_INPUT
    wInput:                     WORD;                               // Inputword
    byBitNr:                    BYTE;                               // Bitnumber (Range 0 - 15)
END_VAR

VAR
END_VAR

BEGIN
IF (BYTE_TO_INT(byBitNr) >= 0) AND (BYTE_TO_INT(byBitNr) <16) THEN
    DAC_ResetBitOfWord := wInput AND (NOT SHL(IN:=dat,N:=BYTE_TO_INT(byBitNr)));
END_IF;

END_FUNCTION

